<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // https://leetcode-cn.com/problems/valid-palindrome/
        var isPalindrome = function(s) {
            s = s.toLowerCase().split('').filter(item => {
                return (item >= 'a' && item <= 'z') || (item >= '0' && item <= '9')
            });
            let str = s.reverse().join('');
            // s.reverse() 会改变 s
            s.reverse();
            return s.join('') === str;
        };
        console.log(isPalindrome("race a car"));
    </script>
</body>
</html>